/*
 * SVGGenerator.h
 *
 *  Created on: 20.11.2012
 *      Author: shadius
 */

#ifndef SVGGENERATOR_H_
#define SVGGENERATOR_H_
#define COLUMN_COUNT 2
#define COLUMN_TIME 0
#define COLUMN_VALUE 1
#include <string>
#include <iostream>
#include <fstream>
#include <boost/numeric/ublas/matrix.hpp>
#include <math.h>
#include <memory>
#include "IFastDataApprox.h"
#include "plotter.h"
#include "TimeUtils.h"

using namespace std;

typedef struct _LIMITS {
	double xmin;
	double xmax;
	double ymin;
	double ymax;
} LIMITS, *LLIMITS;

class SVGGenerator {
public:
	SVGGenerator();
	virtual ~SVGGenerator();
	void draw(LPAPPROXPOINT ignewPoints, LPAPPROXPOINT bgPoints,
			LPAPPROXPOINT igPoints, int len, string output);
private:
	LIMITS findLimits(LPAPPROXPOINT ignewPoints, LPAPPROXPOINT bgPoints,
			LPAPPROXPOINT igPoints, int len);
	void findLimitsForY(double value, LIMITS& limits);
	void findLimitsForX(double value, LIMITS& limits);
	void drawFunction(LPAPPROXPOINT func, int len, SVGPlotter& plotter);
};
#endif /* SVGGENERATOR_H_ */
